//<SCRIPT LANGUAGE=javascript>
//<SCRIPT>
//Find:    {[^= ]+=}{[^"' >]+}
//Replace: \1"\2"

//{<img[^>]+[^/]}{>}
//\1 /\2

//{<input[^>]+}{>}
//\1 /\2

//<br>
//<br />
function mouseover(){
var e = window.event.srcElement||{};
	if( e.classOver )e.className += " "+e.classOver;
}
function mouseout(){
var e = window.event.srcElement||{};
	if( e.classOver )e.className = e.className.replace(" "+e.classOver,"");
}
function preSelect(e){
	e = e || event.srcElement;
	if( event.button == 2 )return;
	var r = document.body.createTextRange(); r.moveToElementText(e); r.select();
}
function defined(v){ return typeof(v)!='undefined' }
function isDefined(v){ return defined(v); }

function isErrorEx(ret,showNot,caller){
		if( !ret )return false;
		if( typeof(ret) == "string" )ret = ret.replace(/^<!--[^>]+?-->\s+/g,"");
		if( isObjectError(ret,showNot,caller) || isXMLError(ret,showNot,caller) )return true;
		if( !isString(ret) )return false;
		if( !remTags(ret).match(/^error/i) )return false;
		if( showNot )return true;
		alertHTML(unescape(ret),caller);
		return true;
}
function isRDSError(rs,noShow,caller){
	if( !(rs = isRSObject(rs)) )return false;
	if( !rs.State || rs.RecordCount < 1 )return false;
	if( !rs.Fields(0).Name.match(/Error/i) ) return false;
	if( noShow )return true;
	for( var i=0,s=''; i < rs.Fields.Count; i++ )
		if( rs.Fields(i).Value )s += rs.Fields(i).Value + "\n";
	alertHTML( getFuncName(caller)+"(...)\n"+s );
	return rs;
}
function isRSObject(obj){ 
	if( obj && defined(obj.StayInSync) )return obj;
	if( !isString(obj) )return false;
	try{
		var root = new ActiveXObject("Microsoft.XMLDOM");
		var rs = new ActiveXObject("adodb.recordset");
		if( !root.loadXML(obj) )return false;
		rs.open(root);
		return rs;
	}catch(e){return false}
}
function isObjectError(ret,noShow,caller){
	return isRDSError(ret,noShow,caller) || isRSOError(ret,!noShow,caller);
}
function isXMLError(text,noShow,caller){
		if( typeof(text) != "string" )return false;
		if( !text.match(/^\s*</) )return false;
var xml = getXMLObject();
		xml.loadXML(text.replace(/[\S]+=[^">\s]/g,""));
		if( xml.xml == "" )return false;
		var errorNode = xml.selectSingleNode("Error | error");
		if( !errorNode )return false;
		if( noShow )return true;
		alertHTML(getFuncName()+"(...)\nXML:\n"+unescape(errorNode.text));
		return true;
}

function isRSOError(co,show,caller){
var o;
	for( o in co )
		if( o == "error" ){
			if( show )showRSOError(co[o],caller);
			return true;
		}else return false;
	return false;
}
function showRSOError(error,caller){
	if( isString(error) )return alertHTML(unescape(error),caller);
	alertHTML(getFuncName(caller)+"(...)\n"+(error.number?"Error: " + error.number + "\n":"") + unescape(error.description));

}
function alertHTML(text,caller){
var callerName = getFuncName(caller)?getFuncName(caller)+"(...)":"";
	if( !text.match(/<html>/i) )
		text = "<pre style='background-color:buttonface'>"+text+"</pre>";
	return showModalDialog("/Include/Alert.htm",{text:(callerName?callerName+"<br>":"")+text},"status:0;resizable:1;help:0");
//	else alertText((callerName?callerName+"\n":"")+text);
}
function alertText(text){
	alert(unescape(text).replace(/<.+?>/g,"").replace(/^\s*$/gm,"").replace(/^\s*(\S+)/gm,"$1").replace(/[\n|\r]{2,}/g,"\n").substr(0,256));
}

function showSOAPError(result,elEncode){
	if( !result.error )return false;
	var s = result.errorDetail.string;
	if( defined(elEncode) ){
		elEncode.innerHTML = "<pre>"+s+"</pre>";
		s = elEncode.innerText;
	}
	return alert(s) || true;
}

function fixedFormat(number,template){
	return template.replace(new RegExp(template.substr(template.length-1) + "{" + (number+'').length + "}$"),number);
}
function formatMoney(n){
	return (n.toString().match(/(\d*)[.]?/)[1]||"0").match(/\d/g).reverse().join('').match(/\d{1,3}/g).join(',').match(/./g).reverse().join('')+(n.toString().match(/[.]+\d+/)||{})[0]||"";
}
function isRSError(co,doNotShowError){
	if( co.status != 0 )
		return co.data;
	var retObj = eval(co.return_value);
	if( retObj && retObj.errorObject == true ){
		if( !doNotShowError )
			alert("Error " + retObj.number + " in [" + getFunctionName(isRSError) + "].\n" + retObj.description);
		return retObj;
	}
	return false;
}
function argArray(){
	try{
	for( var i=0,a=new Array(),args=argArray.caller.arguments; i < args.length; i++ )
		a.push(args[i])
	return a;
	}catch(e){return new Array()}
}
function roundTo(number,scale){
var sc = Math.pow(10,scale);
	return Math.round(number*sc)/sc;
}
function getParamInt(name,request){
	var i = parseFloat(getParam(name,request));
	return isNaN(i)?0:i;
}
function getParam(name,request){
var re = new RegExp(name+"=[^&]*","ig");
var s = (request || location).search.replace(/[?]/,"").match(re);
	return s?s[0].replace(new RegExp(name+"=","i"),""):"";
}
function dateFormat(date){
	var d = new Date(date);	return (d.getMonth()+1)+'/'+d.getDate()+"/"+d.getFullYear();
}
function getAge(date){
var d2 = new Date();
var d1 = new Date(new String(date));
var dd = d2.valueOf() - d1.valueOf();
var dm = new Date(dd);
	return (dm.getFullYear()-1970) + Math.round((dm.getMonth()+1)/12*10)/10;
}
function getElementID(el){
var i = getElementIndex(el);
	return el.id +(i<0?"":"["+i+"]");
}
function getElementIndex(el){
var EL = eval(el.id);
	if( el == EL )return -1;
	for( var i=0; i < EL.length; i++ )
		if( el == EL[i] )return i;
}
function me(){return me.caller}
function getCallerName(func){
var a = (func || getCallerName).caller;
	if( !a || !a.caller )return "";
	a = a.caller.toString().match(/function ([^\(\s]+)/)
	if( a && a[1] )return a[1];
	return "";
}
function getFuncName(func){
var a = arguments.length? func : getFuncName.caller;
	if( !a )return "";
	a = a.toString().match(/function ([^\(\s]+)/)
	if( a && a[1] )return a[1];
	return "";
}
function getFunctionName(func){
var a = (func || getFunctionName).caller.toString().match(/function ([^\(\s]+)/)
	if( a && a[1] )return a[1];
	return "";
}
function getArguments(start){
	var args = getArguments.caller.arguments;
	if(!start)start=0;
	if( typeof(args[start]) == 'undefined' )return ;
	if( args[start] instanceof Array )return args[start];
	for( var i=start,a=new Array(); i < args.length; i++ )
		a.push(args[i]);
	return a;
}
function refreshOpener(){
	(getOpener()||{}).refresh = true;
}
function getOpener(){return typeof(dialogArguments)!='undefined'?dialogArguments.opener:top.opener}
function getScriptServer(){
var a = location.href.match(/(.+\/\/[^/]+)\//);
  return (a && a[1])?a[1]:"";
}
function mapPath(path){
	if( path.indexOf("/") == 0 )return getScriptServer()+path;
	return getScriptURLPath()+"/"+path;
}
function getASPPath(){
	return location.href.replace(/[.].+[.]/,".").replace(/[?].*/,"").replace(/[^.]+$/,"asp");
}
function getLocation(){
	return location.href.replace(/[?].*/,"").replace(/[^.]+$/,"asp");
}
function getScriptName(){
var a = location.href.match(/([^/]+)$/);
  return (a && a[1])?a[1]:"";
}
function getPath(name){
var a = name.match(/.+[\\\/]/);
	return a?a[0].substr(0,a[0].length-1):"";
}
function getPathEx(name){
var a = name.match(/(.+)[\/\\]+.*$/);
  return (a && a[1])?a[1]:"";
}
function getScriptURLPath(){ return getPathEx(location.href) }
function getScriptBaseName(){
var a = getScriptName().match(/([^/.]+)/);
  return (a && a[1])?a[1]:"";
}
//Elements
function getOpener(){ return typeof(dialogArguments)!='undefined'?dialogArguments.opener:top.opener }
function getLeftPos(e){
  if( !e)return 0;
  var n = e.offsetLeft + getLeftPos(e.offsetParent);
  return n;
}
function getTopPos(e){
  if( !e)return 0;
  var n = e.offsetTop + getTopPos(e.offsetParent);
  return n;
}
function findPrevSiblingByAttr(el,attrName,attrValue){
	for( var EL=el ; el; el = el.previousSibling )
		if( el[attrName] == attrValue )return el;
	return EL.parentElement?findPrevSiblingByAttr(EL.parentElement,attrName,attrValue):null;
}
function selectElementsByAttribute(node,attrName,attrValue){
var aFlds = new Array();
	for(var i=0; i < node.all.length; i++ )
		if( defined(node.all[i][attrName]) && 
				(!defined(attrValue) || node.all[i][attrName] == attrValue) )
			aFlds[aFlds.length] = node.all[i];
	return aFlds;
	function defined(v){return typeof(v) != 'undefined'}
}
function findElementByAttr(node,attrName,attrValue,all){
var aFlds = new Array();
var re = new RegExp("^"+attrValue+"$","i");
var n;
	for(var i=0; i < node.all.length; i++ ){
		n = node.all[i];
		if( n.tagName != "OPTION" && defined(n[attrName]) && 
				(!defined(attrValue) || n[attrName].match(re)) ){
			aFlds[aFlds.length] = n;
			if( !all )break;
		}
	}
	return all ? aFlds : (aFlds[0] || null);
	function defined(v){return typeof(v) != 'undefined'}
}
function getParentByTag(el,tagName){return getParentElementByTagName(el,tagName)}
function getParentElementByTagName(el,parentName){
	parentName = parentName.toLowerCase();
	for( el = el.parentElement; el; el = el.parentElement )
		if( el.tagName.toLowerCase() == parentName )return el;
		return null;
}
function getParentByAttr(el,attrName,value){
	for( ; el; el = el.parentElement )
		if( defined(el[attrName]) && (!defined(value) || el[attrName] == value) )return el;
		return null;
}
function getParentElementByAttrName(el,attrName,value){
	for( el = el.parentElement; el; el = el.parentElement )
		if( defined(el[attrName]) && (!defined(value) || el[attrName] == value) )return el;
		return null;
}
function getElementsByAttr(parent,attrName,value){
var all = parent.all;
	for( var i=0,els=new Array(); i < all.length; i++ )
		if( defined(all[i][attrName]) && (!defined(value) || all[i][attrName] == value) )
			els[els.length] = all[i];
	return els;
}
function getElementsByName(elementName,parent,aEls){
	aEls = aEls || new Array();
	if( typeof(elementName) != "string" ){
		for( var i=0; i < elementName.length; i++ )
			getElementsByName(elementName[i],parent,aEls);
		return aEls;
	}
	var eDSOs = new Enumerator((parent || document).all.tags(elementName.toUpperCase()));
	for( ; !eDSOs.atEnd(); eDSOs.moveNext() )
		aEls[aEls.length] = eDSOs.item();
	return aEls;
}
function getElmIndex(el){
var e = eval(el.id);
var uid = el.uniqueID;
	if( uid )return -1;
	for( var i; i < e.length; i++ )
		if( uid == e[i].uniqueID )return i;
}
//************** SELECT *****************
function selectSelect(sel,value){
	for( var i=0; i < sel.length; i++ )
		if( sel[i].value == value ){sel[i].selected=true;	break;}
	return value;
}
//***************************************
function setElementValue(el,value){
	if( el.tagName && el.tagName.match(/input|textarea/i) )
		switch(el.type){
			case "radio":
			case "checkbox":
				return el.checked = (value ? true : false);
			default:
			return el.value = value;
		}
	if( el.tagName && el.tagName.match(/select/i) )
		return selectSelect(el,value);
	return el.innerHTML = value;
}
function getElementValue(el,integer){
	if( el.tagName && el.tagName.match(/(input|select|textarea)/i) )
		switch(el.type){
			case "radio":
			case "checkbox":
				return integer?(el.checked?1:0):el.checked;
			default:
			return el.value;
		}
	return el.innerHTML;
}
function remTags(text){return text.replace(/<[^>]+?>/g,'');}
function tabs(c,n){
	for( var s=''; n--; s+=c ){};
	return s;
}
function trim(s){ 
	if( !defined(s) || (!typeof(s)=="string" && !(s instanceof String)) )return s;
	s = s.replace(/\x00/g,"");
	return s.replace(/^\s+/,"").replace(/\s+$/,"");
}
function trimEx(s){ return trim(s).replace(/\s\s/," ") }
function clearSelection(){setTimeout("document.selection.empty();",100);}
// Cookies Section
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}
function getCookie(name) { // use: getCookie("name");
  var re = new RegExp(name + "=([^;]+)");
  var value = re.exec(document.cookie);
  return (value != null) ? unescape(value[1]) : null;
}
////////////////////////
// DHTML
function setToolTip(el,title,thread){
//	if( eval(toolTip.element) == el )return;
	(toolTip||{}).element = el?el.uniqueID:"";
}
function getSELText(sel){return getSELAttr(sel,"text")}
function getSELAttr(sel,attrName){return sel.selectedIndex>=0?sel[sel.selectedIndex][attrName]:null}
function setSELValue(sel,value){
	if( !defined(value) )	return sel.selectedIndex = -1;
  for(var s=0; s < sel.length; s++)
    if( sel[s].value == value )
			return sel[s].selected=true;
	var re = new RegExp("^"+value.replace(/([%$!])/g,"[$1]")+"$","i");
  for(s=0; s < sel.length; s++)
    if( sel[s].text.match(re) )
			if( sel[s].selected )return true;
			else return sel[s].selected=true;
	sel.selectedIndex = -1;
}
function fillSELECTWithNumbers(sel,from,to){
var j = from < to?1:-1;
	for( var i=from; i != to; i+=j )
		sel[sel.length] = new Option(i,i);
}
function fillSELECTFromRS(sel,rs,valueName,textName,selValue){
	if( isString(rs) ){
		var src = rs;
		rs = new ActiveXObject("ADODB.Recordset");
		try{rs.Open(src);	}catch(e){ alert(unescape(e.description));return;  }
		if( isRDSError(rs) )return;
	}
	sel.length = 0;
	if( rs.recordCount < 1 )return;
	for( rs.moveFirst(); !rs.EOF; rs.MoveNext() )
		sel.options.add(new Option(rs(textName).value,rs(valueName).value));
	setSELValue(sel,selValue);
}
function getFieldNameFromDataFld(s){
	if( !isString(s) )s = s.name;
	if( !s )return '';
	var a  = s.match(/[\^]([^\^]+)$/);
  if( a )return a[1];
  return "";
}
function getDataSrcFromDataFld(s){
	if( !isString(s) ){
		s = getParentElementByAttrName(s,"dataSrc");
		return s?s.dataSrc:'';
	}
	var a = s.match(/^([^\^]+)[\^]/);
  if( a )return a[1].replace(/[#]/,'');
  return "";
}
function getRecNumFromDataFld(s){
var a = s.match(/\^(\d+)\^/);
  if( a && a[1])return a[1];
  return 1;
}
// XML Stuff
function getXMLObject(url){
var xml = new ActiveXObject("Microsoft.XMLDOM");
	  xml.validateOnParse = false;
    xml.resolveExternals = true;
    xml.preserveWhiteSpace = false;
		xml.async = false;
		if(!url)return xml;
		xml.load(url);
var check = checkParseError(xml);
		if( !check )return xml;
		alert(check);
		return null;
}
function checkParseError(xml){
var s,pe;
	if( xml.parseError.errorCode == 0 )return false;
	pe = xml.parseError;
  s = "Error in " + pe.url + "\n" +
      pe.reason + "Source: " + pe.srcText + "\n" +
      "In line " + pe.line + ", pos " + pe.linepos;
	return s;
}
function appendChild(parentNode,childName,attrs){
	var a,childNode = parentNode.appendChild((parentNode.ownerDocument || parentNode).createElement(childName));
	for( a in attrs )
		childNode.setAttribute(a,attrs[a]);
	return childNode;
}
var iii = 38;
function cleanFields(node,aKeys){
	var nodeNext = node.nextSibling;
	node = node.firstChild;
	var orAtt = node.attributes;
	for( var i=0; i < orAtt.length; i++ )
		if( node.getAttribute(orAtt[i].baseName) == nodeNext.getAttribute(orAtt[i].baseName) )
			nodeNext.removeAttribute(orAtt[i].baseName);
	return;
	var sForce = nodeNext.getAttribute("rs:forcenull")+' ';
	for( var j=0; j < aKeys.length; j++ )
		sForce = sForce.replace(" "+aKeys[j]+" ","");
	var a =sForce.match(/\w+/g);
	a.length= ++iii;
	nodeNext.setAttribute("rs:forcenull",a.join(' '));
}
function updateRS(rs,url){
var xmlDom = new ActiveXObject("Microsoft.XMLDOM");
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	rs.Save(xmlDom,1);
var aKeys = getKeyColumns(xmlDom);
var os = xmlDom.getElementsByTagName("rs:original");
	for( var o = 0; o < os.length; o++ )
		cleanFields(os[o],aKeys);
//		for( var i=0; i < aKeys.length; i++ )
//		 os[o].nextSibling.removeAttribute(aKeys[i]);
	xmlhttp.Open("POST", url, false);
	xmlhttp.Send(xmlDom);
	var ret = xmlhttp.responseText.replace(/<![^>]+>\r\n/,"");
	rs.UpdateBatch();
//	xmlhttp.responseXML.loadXML(xmlhttp.responseText);
//	rs.close();
//	rs.open(xmlhttp.responseXML);
	return ret;
	//Locals
	function getKeyColumns(xmlDom){
	var aKeys = new Array();
	var as = xmlDom.selectNodes("//s:AttributeType[not(@rs:writeunknown)]");
		for( var i=0; i < as.length; i++ )
			aKeys[aKeys.length] = as[i].getAttribute("name");
		return aKeys;
	}
}
// SOAP like stuff
var managerPath = "/manager/include";
var mangerLib = managerPath + "/Manager_Lib.asp";
var dwnPublic = managerPath + "/public/DownLoads.asp";
var updPublic = managerPath + "/public/Updates.asp";
function SOAP(updatePath){
	this.updatePath = updatePath || updPublic;
	this.updateElement = SOAP_updateElement;
	this.updateField = SOAP_updateField;
}
function SOAP_updateElement(el,value){
	if( !el )el = event.srcElement;
	var name = el.name || (typeof(el)=='string'?el:'') || el.dataFld;
	var dataSrc = (el.dataSrc||'').replace(/^#/,"");
	if( !defined(value) )value = defined(el.value)?el.value:el.innerHTML;
	if( getFuncName(this.constructor) == "SOAP" )
		return this.updateField(dataSrc || getDataSrcFromDataFld(name) || getDataSrcFromDataFld(el),
														getFieldNameFromDataFld(name) || el.name || el.dataFld,
														value,
														getArgumentsEx(2)); 
	else
		return SOAP_updateField(dataSrc || getDataSrcFromDataFld(name)||getDataSrcFromDataFld(el),getFieldNameFromDataFld(name)||el.name || el.dataFld,value,getArgumentsEx(2));
}
function SOAP_updateField(dataSrcName,fieldName,fieldValue){
	if( typeof(dataSrcName) == 'object' )dataSrcName = (getParentByAttr(dataSrcName,"dataSrc")||{}).dataSrc;
	if( !dataSrcName )throw new Error(0,"No dataSrc property specified for \""+fieldName+"\"!");
	var path = getFuncName(this.constructor) == "SOAP"?this.updatePath:updPublic;
	var aParams = new Array(fieldName,fieldValue);
	var aRgs = getArgumentsEx(3);
	if( aRgs && aRgs.length )aParams = aParams.concat(aRgs);
	return sendRequestXMLEx(path,dataSrcName.replace(/^#/,""),aParams);
}
function executeUpd(){var _u;
	return sendRequestXMLEx(updPublic,getFuncName(executeUpd.caller),arguments.length?arguments:_u);
}
function httpRS(path,callBack){
	if( callBack )return oDownload.startDownload(path,callBack);
	var rs = new ActiveXObject("adodb.recordset");
	rs.Open(path);
	return isErrorEx(rs,false,httpRS.caller)?null:rs;
}
function sendRequestXMLEx(url,functionName,params,callBack){
	functionName = functionName || getFuncName(sendRequestXMLEx.caller);
	url = url || getLocation();
	var aArgs = getArgumentsEx(2);
	var async = aArgs.length && isFunction(aArgs.slice(-1)[0]);
	if( async )return oDownload.startDownload(
			url+"?"+buildFuncCallEx(functionName,aArgs.slice(0,-1)),aArgs.slice(-1)[0]);
	var ret = sendRequestXML(url,functionName,aArgs);
	if( checkResponseError(ret,false,sendRequestXMLEx.caller) )return null;
	return ret;
}
function buildFuncCallEx(fn,a){
	var p=new Array();
	for( var i=0; a && i < a.length; i++ )
		switch(typeof(a[i])){
			case "string"		: p.push('unescape("'+escape(a[i])+'")');break;
			case "date"			: p.push('new Date(unescape("'+escape(a[i])+'"))');break;
			case "undefined": if(i < a.length-1 )p.push('undefined');break;
			default					: p.push(a[i]);
		}
	return fn + "(" + p.join(",") + ")";
}
function getArgumentsEx(start,end){
	var args = getArgumentsEx.caller.arguments;
	var aParams = new Array();
	end = end && end < 0 ? args.length + end : Math.min(args.length,end||1000);
	for( var p=(start||0); p < end; p++ )
		aParams = aParams.concat(args[p]);
	return aParams;
}
function sendRequestXML(url,functionName,params){
var xml = functionName || getFuncName(sendRequestXML.caller);
	url = url || getLocation();
	if( arguments.length > 2 )
		xml = buildRequestXML(xml,getArguments(2));
	for( var ret=null; ret == null; ){
		try{
			var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			xmlhttp.Open("POST", url, false);
			xmlhttp.Send(xml);
			ret = xmlhttp.responseText.replace(/^<!--[^>]+>[\n\r]+/,"");
		}catch(e){
			if( !confirm((e.description||"Error while connecting to server.")+"\n\nDo you want to try again?" ) ){
				ret = "";
				break;
			}
		}
	}
	var status = xmlhttp.status;
	if( status != 200 )return alertHTML(ret,sendRequestXML.caller.caller);
	if( ret.match(/^.*error/i) || status != 200 )return {error:"<Error>"+ret+"</Error>"};
	if( ret.match(/^<[^>]+>error/i) )return {error:ret};
	return ret;
}
/*
<Request ServeceType="" ServiceName="">
	<Pearams><Param type=""></Param>
					 <Param type=""></Param>
	</Params>
</Request>
*/
function buildRequestXML(functionName,params){
var xml = getXMLObject();
var xmlRequest = appendChild(xml,"Request");
		xmlRequest.setAttribute("ServiceName",functionName);
		xmlRequest.setAttribute("ServiceType","function");
		if( !params || !params.length )return xml;
var xmlParams =	appendChild(xmlRequest,"Params");
		for( var i=0; i < params.length; i++ )
			appendChild(xmlParams,"Param",{type:typeOf(params[i])}).text = escape(params[i]);
		return xml;
}
function buildRequestXML_(functionName,params){
var xml = getXMLObject();
var xmlRequest = appendChild(xml,"Request");
		xmlRequest.setAttribute("function",functionName);
var xmlParams =	appendChild(xmlRequest,"params");
		setAttributes(xmlParams,params);
		return xml;
	// Locals
	function setAttributes(node,attr){
		var a;
		if( isArray(attr) )
			for( p=0; p < attr.length; p++ ){
				a = attr[p]==null?"":attr[p];
				if( isObject(a) )setAttributes(node,a);
				else node.setAttribute("_"+p,escape(a));
			}
		else
			for( p in attr){	
				a = attr[p]==null?"":attr[p];
				if( isObject(a) )setAttributes(node,a);
				else node.setAttribute(p,escape(a));
			}
		return xml;
	}
}
function checkResponseError(ret,showNot,caller){
		if( isErrorEx(ret,showNot,caller) )return true;
		if( !ret || !ret.error)return false;
		if( showNot )return true;
		var xml = getXMLObject();
		xml.loadXML((ret.error||ret).replace(/[\S]+=[^">\s]/g,""));
		alert(unescape(xml.text || ret.error).replace(/<[^>]*>/g,""));
		return true;
}
function callSOAPonChange(value,ID,param1,param2,param3){
var el = event.srcElement;
	if( !defined(el.value) )el.value = el.innerHTML;
	if( el.value != el.innerHTML ){
		el.value = el.innerHTML;
		if( el.onupdate )eval(el.onupdate)(el)
		else soap.updateElement(el,value,ID,param1,param2,param3);
	}
}
function initSpanEdit(onDeactivate,className,classOver){
	document.onmouseover = mouseover;
	document.onmouseout = mouseout;
	var spans = selectElementsByAttribute(document.body,"edit");
		for( var i=0; i < spans.length; i++ )
			spans[i].contentEditable = "true";
	var spans = selectElementsByAttribute(document.body,"contentEditable","true");
		for( var i=0; i < spans.length; i++ ){
			spans[i].onactivate = spans[i].ondeactivate = onDeactivate;
			spans[i].over = "true";
			spans[i].className = isDefined(className)?className:"editField";
			spans[i].classOver = isDefined(classOver)?classOver:"editOver";
			if( !spans[i].style.width )spans[i].style.width = "100%";
		}
}
function releaseApplicant(logOff){return sendRequestXMLEx(updPublic,"releaseApplicant",logOff)}
// UNEVAL stuff
function unEval(oo,sub){
var o,s = "";
		if( isArray(oo) ){
			for( o=0; o < oo.length; o++ )
				s += (isObject(oo[o])?unEval(oo[o]):preserve(oo[o])) + ',';
			return "new Array("+s.replace(/,$/,"")+")";
		}
		for( o in oo )
			s += '"'+o+'":'+(isObject(oo[o])?unEval(oo[o]):preserve(oo[o]))+',';
		s = "{" + s.replace(/,$/,"") + "}";
		return (callerName()!="unEval"?"_oo_=":"")+ s;
	//Locals
	function isDate(o){return objectName(o)=='Date' }
	function isObject(o){ return typeof(o) == 'object' && !isDate(o)}
	function isArray(o){ return isObject(o) && objectName(o)=='Array' }
	function callerName(){
		var caller = callerName.caller;
		if( !caller )return "";
		return getFunctionName(caller.caller);		
	}
	function getFunctionName(s){
		if( !s )return "";
		var a = s.toString().match(/function\s+([^(]+)/);
		return a?a[1]:"";
	}
	function preserve(s){
		if( isString(s) || isDate(s) )return '"'+(s+"").replace(/"/,'\\"')+'"';
		return s;
	}
}
//////////////////////////////////////////
function typeOf(v){return typeof(v)!='object'?typeof(v):objectName(v)}
function objectName(o){
	return !o?"":getFuncName(o.constructor);
}
function isString(o){ return typeof(o)=='string' }
function isObject(v){	return v && typeof(v) == "object"; }
function isArray(v) {	return isObject(v) && objectName(v)=="Array"; }
function isDate(o)  { return objectName(o)=='Date' }
function isFunction(o)  { return objectName(o)=='Function' }
//Forms and Stuff
function doEnterKey(){if( event.keyCode == 13 && event.srcElement.type != "button" )event.keyCode = 9;}
function submitInTarget(form){
	form.target = "XXX";
	open("about:blank",form.target,"height=100,width=100,status=no,toolbar=no,menubar=no,location=no,left=0,top=0");
	return true;
}
var SHOW_DIALOG_RES = "resizable:1; status:0;";
function updateRSField(field,value){ if( field.value != value )field.value = value }
function reloadMe(name){
	if( name ){
		if( !top.refreshThem )top.refreshThem = {};
		top.refreshThem[name] = window;
	}
	if( window.refresh )location.reload();
	setTimeout("reloadMe('"+(name||'')+"')",1000);
}
function refreshIt(name,clear){
	try{
	if(top.refreshThem && top.refreshThem[name])
		top.refreshThem[name].refresh = clear?false:true
	}catch(e){}
}
function doSalary(el,thread){
//	if( !thread )
//		return setTimeout(getFuncName()+"("+el.uniqueID+",true)",100);
	var sal = calcSalary(el.value);
	if( el.value != sal ){
		el.value = sal;
		if( el.onchange )el.onchange();
	}
//	return false;
}
function doSalaryHTML(el,hoursPerWeek,thread){
	if( !thread )
		return setTimeout(getFuncName()+"("+el.uniqueID+","+(hoursPerWeek||40)+",true)",100);
	el.innerHTML = calcSalary(el.innerHTML,hoursPerWeek);
	return false;
}
function calcSalary(text,hoursPerWeek){
	if( text.match(/\/$/) )
		return parseInt(parseInt(text)/12);
	if( text.match(/[*]$/) )
		return parseInt(parseInt(text)*(hoursPerWeek||40)*52/12);
	return text;
}
function buildFuncCall(funcName,aParams){	return funcName+"("+aParams.join(",")+")"; }
function buildParamsArray(aParams){
	for( var i=0,a=new Array(); i < aParams.length; i++ )
		a.push( typeof(aParams[i])=="number"?aParams[i]:"unescape('"+escape(aParams[i])+"')" );
	return a;
}
function triggerHiddens(body,hide){
	var hiddens = selectElementsByAttribute(body,"hidden");
	for( var i=0; i < hiddens.length; i++ )
		if( hide )
			hiddens[i].style.display = hiddens[i].hidden=="true"?"none":"";
		else
			hiddens[i].style.display = hiddens[i].hidden=="true"?"":"none";
}
function showApplMessage(send){
	var features = "scroll:0;status:0;resizable:1;dialogHeight:150px;dialogWidth:450px;help:0";
	var w = showModelessDialog("/include/ApplicationMessage.asp?pageID="+_pageID(),null,features);
}
function cropWindow(direction){
var	top = (window.screenTop-24)+"px";
var	left = (window.screenLeft-6)+"px";
var eBody = document.body;
	if( !direction || direction == 'h' )external.dialogWidth=(eBody.scrollWidth+10)+"px"
	if( !direction || direction == 'v' )external.dialogHeight=(eBody.scrollHeight+35)+"px"
//	external.dialogTop = top;
//	external.dialogLeft = left;
}
function repaintElement(el,thread){
var uid = el.uniqueID;
	if( repaintElement[uid] && !thread )clearTimeout(repaintElement[uid]);
	if( !thread )
		return repaintElement[uid] = setTimeout("repaintElement("+uid+",true)",1000);
	repaintElement[uid] = null;
var w = (parseInt(el.style.borderWidth)+1)||'';
	el.style.borderWidth = w+1;
	el.style.borderWidth = w;
}
function repaintWindow(w){
	(w||window).resizeBy(0,-1);
	(w||window).resizeBy(0,1);
}
function getParentFrame(win){
var frm = (win||self).frameElement || (win||self);
	return frm.offsetParent;
}
function closeFrameSet(frame){
var pFrs = getParentFrame(frame);
	if( !pFrs || pFrs.id == top.document.body.id )top.close();
	else pFrs.document.location = "/blank.htm";
}
//Properties
function _pageID(){ return getParam("PageID") }
function features(add){
var s = ",status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,top=0,left=0,"+(add||'');
var statusBar = s.match(/status=yes/i)?true:false;
	return "height="+(screen.availHeight-30-(statusBar?30:0))+",width="+(screen.availWidth-10)+s;
}
